
var modulelogTable;

//日志类型，0模块访问日志 1 登入日志   2 登出日志
var logtypeOptions = [{id: '0', text: '模块访问日志'},{id: '1', text: '登入日志'},{id: '2', text: '登出日志'}];

/**
 * 表格列定义
 * @type {*[]}
 */
var tableColumns = [
    {field: "id",title: "#",width: 20, titleHide: true,
        selector: {
            class: "m-checkbox--solid m-checkbox--brand"
        }
    },
    {field: "logtime",textAlign: 'center', title: "日志时间", width: 160},
    {field: "userid",textAlign: 'center', title: "操作用户", width: 100},
    {field: "logtype",textAlign: 'center', title: "日志类型", width: 100,
        template: function (row) {
            var content = '';
            if (row.logtype == '0') {
                content = '模块访问日志';
            } else if (row.logtype == '1') {
                content = '登入日志';
            } else if (row.logtype == '2') {
                content = '登出日志';
            }
            return content;
        }},
    {field: "modulename",textAlign: 'center', title: "模块名", width: 160},
    {field: "moduleurl",textAlign: 'center', title: "模块路径", width: 200}
];

/**
 * 初始化表格定义
 */
var modulelogTableInit = function() {
    modulelogTable = $("#modulelog-table").mDatatable(getMDatatableOption(basePath + "/hcSysModulelog/list", null, tableColumns));
};

jQuery(document).ready(function() {
    initPage();
    modulelogTableInit();
    initEvent();
});

function initPage() {
    $("#logtype").select2({
        placeholder:"请选择日志类型",
        data:logtypeOptions,
        allowClear:true
    });
    $("#logtime").datetimepicker({
        enabled: false,
        minView: 2,
        todayHighlight: true,
        autoclose: true,
        language: 'zh-CN',
        format: 'yyyy-mm-dd',
        forceParse: 0,
        pickerPosition: 'bottom-right',
    });

}

function initEvent() {

    /**
     * 查询
     */
    $("#m_search").on("click", function () {
        var param = {
            logtype: $.trim($("#logtype").val()),
            logtime: $.trim($("#logtime").val()),
            userid: $.trim($("#userid").val()),
            modulename: $.trim($("#modulename").val())
        };
        queryMDatatable(modulelogTable, param);
    });

   


 
}











